Skip to content

fix: add buffer-length check in capture-menger.c - #182

Open
anupamme wants to merge 1 commit into
layoutit:mainfrom
anupamme:fix-repo-cssgraphics-v-001-src-adapters-menger-tools-native-headless-capture-menger-c
Open

anupamme wants to merge 1 commit into
layoutit:mainfrom
anupamme:fix-repo-cssgraphics-v-001-src-adapters-menger-tools-native-headless-capture-menger-c

Conversation

@anupamme

Copy link
Copy Markdown

Summary

Address high severity security finding in src/adapters/menger/tools/native/headless/capture-menger.c.

Vulnerability

Field Value
ID V-001
Severity HIGH
Scanner multi_agent_ai
Rule V-001
File src/adapters/menger/tools/native/headless/capture-menger.c:171
Assessment Likely exploitable
CWE CWE-120
Chain Complexity 2-step

Description: The capture-menger.c tool allocates memory for image buffers using multiplication of width and height parameters without overflow checking. If an attacker can control the width and height values (e.g., through command-line arguments, configuration files, or input data), they can trigger an integer overflow in the multiplication (size_t)width * (size_t)height * 4. This results in a small allocation followed by writes that exceed the allocated buffer size, causing a heap buffer overflow.

Evidence

Exploitation scenario: An attacker who can control the width and height parameters passed to the capture-menger tool provides values like width=1073741824 and height=2.

Scanner confirmation: multi_agent_ai rule V-001 flagged this pattern.

Threat Model Context

This is a Node.js library - vulnerabilities affect downstream consumers who use this package.

Changes

  • src/adapters/menger/tools/native/headless/capture-menger.c

Behavior Preservation

The change is scoped to 1 file on the vulnerable path.


This change addresses a pattern flagged by static analysis. The code path handles user-influenced input and the fix reduces the attack surface against both manual and automated exploitation.


Automated security fix by OrbisAI Security

@netlify

netlify Bot commented Sep 14, 2026

Copy link
Copy Markdown

Deploy Preview for cssgraphics canceled.

Name Link
🔨 Latest commit eec67f2
🔍 Latest deploy log https://app.netlify.com/projects/cssgraphics/deploys/6aa8169c405ad80007b1ede8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant